<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function fs(s) {
        let res = 0
        let tempLen
        let resStr = ''
        for (let i = 0; i < s.length; i++) {
          let left = i - 1
          let right = i + 1
          tempLen = 1
          while (s[left] && s[left] == s[i]) {
            left--
            tempLen++
          }
          while (s[right] && s[right] == s[i]) {
            right++
            tempLen++
          }
          while (s[left] && s[right] && s[left] == s[right]) {
            left--
            right++
            tempLen += 2
          }
          if (tempLen > res) {
            res = tempLen
            resStr = s.slice(left + 1, right)
          }
        }
      }


    </script>
  </body>
</html>
